/**
 * Copyright (C), 2016-2019, 赋拓物联网技术有限公司
 * FileName: User
 * Author:   Administrator
 * Date:     2019/6/12 12:31
 * Description: 用户信息
 * History:
 * <author>          <time>          <version>          <desc>
 * 作者姓名           修改时间           版本号              描述
 **/
package com.scs.application.modules.upms.entity;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.scs.application.core.model.DataEntity;
import com.scs.application.core.utils.excel.annotation.ExcelField;
import com.scs.application.core.utils.excel.consts.FieldAlign;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.Date;

/**
 * @Description: 用户信息
 **/
@Accessors(chain = true)
@Data
@TableName(value = "user")
public class User extends DataEntity implements Serializable {

    @ExcelField(title = "昵称", align = FieldAlign.CENTER, sort = 10)
    @NotBlank(message = "昵称不能为空")
    private String nickname;

    @ExcelField(title = "登录账号", align = FieldAlign.CENTER, sort = 0)
    @NotBlank(message = "登录账号不能为空")
    private String loginKey;

    @JSONField(deserialize = false,serialize = false)
    private String password;

    @NotBlank(message = "组织机构不能为空")
    private String officeId;

    /**
     * 是否管理员用户
     */
    private String isAdmin;

    @ExcelField(title = "启用状态",align = FieldAlign.CENTER, dictType = "common_inactive", sort = 20)
//    @NotNull(message = "启用状态不能为空")
    private Integer inactive;

    private String mobile;

    private String email;

    private String remark;

    private JSONArray rolesId;

    @JSONField(deserialize = false)
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
    private Date gmtLastLogin;

    @TableField(exist = false)
    private String officeName;


    /**
     * 密码有效日期
     */
    private Date gmtExpirePwd;

    public static final int INACTIVE_DISABLED = 0;
    public static final int INACTIVE_ENABLED = 1;

    // 是否是微信默认登录账号
    @TableField(exist = false)
    private Boolean flagDefaultVxLogin;

}
